﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

public partial class OrderCart_PayResult : System.Web.UI.Page
{
    private string _rehtml;
    public string REHTML
    {
        set { _rehtml = value; }
        get { return _rehtml; }
    }
    protected void Page_PreInit(object sender, EventArgs e)
    {
        Page.Theme = BLL.Common.GetWSThemes();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder Sb = new StringBuilder();
        Page.Title = BasePage.WebTitle;
        if (Request.QueryString["t"] != null)
        {
            Sb.Append(" <div class=\"r_zf_zi\" >");
            switch (Request.QueryString["t"].ToString())
            {
                case "1":
                    Sb.Append("<em>恭喜你！订购完成！</em><br/>");
                    Sb.Append("感谢您订购我们的产品，稍候我们的客服人员会与您取得联系，并确认相关事宜。<br />");
                    break;
                case "2":
                    Sb.Append("<em>很抱歉！订购失败！</em><br />");
                    Sb.Append("请确认你的订单信息是否正确，并可以联系我们的客服人员进行咨询。<br />");
                    break;
                case "3":
                    Sb.Append("<em>很抱歉！订购失败！</em><br />");
                    Sb.Append("请确认你的订单信息是否正确，并可以联系我们的客服人员进行咨询。<br />");
                    break;
                case "4":
                    string payid = Request.QueryString["payid"].ToString();
                    Model.PAYTYPE pay = new Model.PAYTYPE();
                    pay = new BLL.PAYTYPE().GetModel(payid);
                    if (pay.PT_BANK == 1)
                    {
                        string orderid = Request.QueryString["orderid"].ToString();
                        DataSet ds = new BLL.PAYDETAIL().P_Order_GetProductZFMX(orderid);
                        foreach (DataRow row in ds.Tables[0].Rows)
                        {
                            if (row["PD_PAYTYPE"].ToString() == payid)
                            {
                                Sb.Append("<em>恭喜你！订购成功！</em><br />");
                                Sb.Append("<em>订单号为:" + orderid + ",需要支付金额为:" + string.Format("{0:F}", row["PD_PAYAMT"]) + "</em><br/>");
                                Sb.Append(row["PT_TEXT1"].ToString()+"<br/>");
                            }
                        }
                    }
                    else
                    {
                        Sb.Append("<em>恭喜你！订购完成！</em><br/>");
                        Sb.Append("感谢您订购我们的产品，稍候我们的客服人员会与您取得联系，并确认相关事宜。<br />");
                    }
                    break;

            }
            Sb.Append("<a href=\"../Users/MyOrder.aspx\">查看订单</a>");
            Sb.Append("</div>");
            REHTML = Sb.ToString();
        }
    }
}
